window.lpTag=window.lpTag||{};lpTag.taglets=lpTag.taglets||{};lpTag.taglets.SurveyLogic=lpTag.taglets.SurveyLogic||function(e){if(!e.survey||"object"!=typeof e.survey||this===window)return!1;this.survey=e.survey.survey||e.survey;this.createQuestionsMap();this.defaultSelectValue=e.defaultSelectValue||"";this.header=this.survey.header||""};!function(e){var t="prototype";e[t].questionTypes={TEXTF:"Text Field",TEXT:"Text Area",SELECT:"Dropdown Box",RADIO:"Radio Button",RADIOH:"Radio Button (side by side)",CHECKBOX:"Checkbox",CSAT:"CSAT"};e[t].validationTypes={EMAIL:"email",NUMBER:"numeric",STRING:"alpha_numeric",CSAT:"csat",PHONE:"phoneNumber"};e[t].errorTypes={EMAIL:"email",NUMBER:"numeric",ILLEGAL_CHARS:"illegal_chars",REQUIRED:"required",CSAT_RANGE:"csat_range",LENGTH:"length",PHONE:"phoneNumber"};e[t].questionsText={MAX_LENGTH:2e3};e[t].csatRange={lowest:0,highest:5};e[t].getAllQuestions=function(){return this.survey&&this.survey.questions&&this.survey.questions.question&&this.survey.questions.question.constructor===Array?this.survey.questions.question:[]};e[t].createQuestionsMap=function(){this.questionLogicMap={};this.questionIdMap={};this.mandatoryQuestions=[];for(var e=this.getAllQuestions(),t=0;tn?s[n]:{}};e[t].submitAnswerGetNextQuestions=function(e,t){this.submitAnswer(e,t);return this.getActiveQuestions({getExcluded:!0})};e[t].getActiveQuestions=function(e){for(var t=this.getAllQuestions(),s={},n=[],i=[],r=!1,o=!(!e||!e.getExcluded)&&e.getExcluded,a=!(!e||!e.mandatoryOnly)&&e.mandatoryOnly,u=0;u',t=this.getActiveQuestions(),s=0;s';if(e.entry){for(var n=0;n"+e.entry[n].value+"";t=!0}}else if(e.lastKnownValue){s+=""+e.lastKnownValue+"";t=!0}return{XML:s+="",hasAnswer:t}};e[t].validateSurvey=function(e){var t={surveyValid:!0,questionsNeeded:[]},s=this.getActiveQuestions({mandatoryOnly:!e||"boolean"!=typeof e||!e});try{for(var n=0;n=this.csatRange.lowest&&e<=this.csatRange.highest};e[t].isValidChars=function(e){return e.search(/<|>|\"/)<0};e[t].isValidEmail=function(e){try{return new RegExp(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(e)}catch(e){return!1}};e[t].isValidPhoneNumber=function(e){try{return new RegExp(/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/g).test(e)}catch(e){return!1}};e[t].isNumber=function(e){return!isNaN(e)};e[t].isString=function(e){return"string"==typeof e};e[t].isValidLength=function(e){return e.length<=this.questionsText.MAX_LENGTH};e[t].dispose=function(){for(var e in this)if(this.hasOwnProperty(e)){this[e]=null;delete this[e]}}}(lpTag.taglets.SurveyLogic);